Syntax
fun main() {
var hello = 'hi mom'
println(hello)
}
-
Has static typing.
-
The language uses camelCase for its functions.
-
:/ annoying.
-
-
Uses
varto declare variables (mutable variable). -
Uses
valto declare constants (immutable variable). -
Has automatic type inference, so both of these are equivalent:
var hello = 'hi mom' var hello: String = 'hi mom' -
Has 'null safety', using
?to allow the type to be null.var hello: String? = 'hi mom'-
Makes
hellonullable.
-
-
The use of
;is optional. -
Functions are 'first class objects', which is very good.
-
Can create lambdas, pass as parameters, etc.
-